package com.linfeng.component.consumer;

import com.linfeng.component.consumer.handle.IConsumerHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RocketMQMessageListener(consumerGroup = "${spring.application.name}", topic = "${spring.application.name}_${spring.profiles.active}")
public class DefaultConsumer implements RocketMQListener<String> {

    @Autowired
    private IConsumerHandler handle;

    @Override
    public void onMessage(String message) {
        log.info("DefaultConsumer消息----{}", message);
        handle.handleMessage(message);
    }
}
